'use strict'
import { View } from '../../../component'
import style from './css.css'
import changeTime from '../../../config/changeTime'

class Item extends React.Component {
  static propTypes = {
    item: PropTypes.object,
    history: PropTypes.object
  }

  render () {
    const item = this.props.item
    const from = item.from[0]
    return (
      <View className={style.messageItem}>
        <View className={style.messageItemPortrait}>
          <View className={style.portrait} style={{ 'backgroundImage': 'url("' + from.avatar + '")' }}></View>
        </View>
        <View className={style.messageItemContent}>
          <View className={style.messageFrom}>{from.name}</View>
          <View className={style.messageContent}>{item.cont}</View>
          <View className={style.messageTime}>{changeTime(item.time / 1000)}</View>
        </View>
        <View className={style.messageItemArrowHide}></View>
      </View>
    )
  }
}

export default Item
